home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oh!X 2001 Spring
/
Oh!X 2001 Spring Special CD-ROM (Japan).7z
/
Oh!X 2001 Spring Special CD-ROM (Japan) (Track 1).bin
/
FBENC
/
TEC-FB^3.sea
/
TEC-FB^3
/
MacType.Incl
next >
Wrap
Text File
|
2000-07-04
|
19KB
|
622 lines
/*
File: MacTypes.Incl
Contains: Basic Macintosh data types.
Version: Technology: Mac OS 8.1
Release: Universal Interfaces 3.1
Copyright: ゥ 1985-1998 by Apple Computer, Inc., all rights reserved.
Convert For FB^3 Takaaki Mizuno
*/
/********************************************************************************
Base integer types for all target OS's and CPU's
UInt8 8-bit unsigned integer
SInt8 8-bit signed integer
UInt16 16-bit unsigned integer
SInt16 16-bit signed integer
UInt32 32-bit unsigned integer
SInt32 32-bit signed integer
UInt64 64-bit unsigned integer
SInt64 64-bit signed integer
*********************************************************************************/
#DEFINE UInt8 AS unsigned char
//#DEFINE UInt16 AS unsigned short
//#DEFINE UInt32 AS UNSIGNED LONG
#DEFINE SInt32 AS LONG
//BIG_ENDIAN
BEGIN RECORD wide
DIM hi AS SInt32
DIM lo AS UInt32
END RECORD
BEGIN RECORD UnsignedWide
DIM hi AS UInt32
DIM lo AS UInt32
END RECORD
/*
//LITTLE_ENDIAN
BEGIN RECORD wide
DIM lo AS UInt32
DIM hi AS SInt32
END RECORD
BEGIN RECORD UnsignedWide
DIM lo AS UInt32
DIM hi AS UInt32
END RECORD
*/
#DEFINE SInt64 AS wide
#DEFINE UInt64 AS UnsignedWide
/********************************************************************************
Base fixed point types
Fixed 16-bit signed integer plus 16-bit fraction
UnsignedFixed 16-bit unsigned integer plus 16-bit fraction
Fract 2-bit signed integer plus 30-bit fraction
ShortFixed 8-bit signed integer plus 8-bit fraction
*********************************************************************************/
//typedef long Fixed;
//typedef Fixed * FixedPtr;
#DEFINE Fract AS long
#DEFINE FractPtr AS POINTER TO Fract
#DEFINE UnsignedFixed AS unsigned long
#DEFINE ShortFixed AS short
/********************************************************************************
Base floating point types
Float32 32 bit IEEE float: 1 sign bit, 8 exponent bits, 23 fraction bits
Float64 64 bit IEEE float: 1 sign bit, 11 exponent bits, 52 fraction bits
Float80 80 bit MacOS float: 1 sign bit, 15 exponent bits, 1 integer bit, 63 fraction bits
Float96 96 bit 68881 float: 1 sign bit, 15 exponent bits, 16 pad bits, 1 integer bit, 63 fraction bits
Note: These are fixed size floating point types, useful when writing a floating
point value to disk. If your compiler does not support a particular size
float, a struct is used instead.
Use of of the NCEG types (e.g. double_t) or an ANSI C type (e.g. double) if
you want a floating point representation that is natural for any given
compiler, but might be a different size on different compilers.
*********************************************************************************/
/*typedef float Float32;
#if defined(__MWERKS__) || defined(THINK_C)
typedef short double Float64;
#else
typedef double Float64;
#endif
#if TARGET_CPU_68K
#if TARGET_RT_MAC_68881
typedef long double Float96;
struct Float80 {
SInt16 exp;
UInt16 man[4];
};
typedef struct Float80 Float80;
#else
typedef long double Float80;
struct Float96 {
SInt16 exp[2]; // the second 16-bits is always zero
UInt16 man[4];
};
typedef struct Float96 Float96;
#endif
#else
struct Float80 {
SInt16 exp;
UInt16 man[4];
};
typedef struct Float80 Float80;
struct Float96 {
SInt16 exp[2]; // the second 16-bits is always zero
UInt16 man[4];
};
typedef struct Float96 Float96;
#endif
*/
/********************************************************************************
MacOS Memory Manager types
Ptr Pointer to a non-relocatable block
Handle Pointer to a master pointer to a relocatable block
Size The number of bytes in a block (signed for historical reasons)
*********************************************************************************/
//typedef char * Ptr;
//typedef Ptr * Handle;
#DEFINE Size AS long
/********************************************************************************
Higher level basic types
OSErr 16-bit result error code
OSStatus 32-bit result error code
LogicalAddress Address in the clients virtual address space
ConstLogicalAddress Address in the clients virtual address space that will only be read
PhysicalAddress Real address as used on the hardware bus
BytePtr Pointer to an array of bytes
ByteCount The size of an array of bytes
ByteOffset An offset into an array of bytes
ItemCount 32-bit iteration count
OptionBits Standard 32-bit set of bit flags
PBVersion ?
Duration 32-bit millisecond timer for drivers
AbsoluteTime 64-bit clock
ScriptCode A particular set of written characters (e.g. Roman vs Cyrillic) and their encoding
LangCode A particular language (e.g. English), as represented using a particular ScriptCode
RegionCode Designates a language as used in a particular region (e.g. British vs American
English) together with other region-dependent characteristics (e.g. date format)
FourCharCode A 32-bit value made by packing four 1 byte characters together
OSType A FourCharCode used in the OS and file system (e.g. creator)
ResType A FourCharCode used to tag resources (e.g. 'DLOG')
*********************************************************************************/
//#DEFINE OSErr AS SInt16
#DEFINE OSStatus AS SInt32
#DEFINE LogicalAddress AS POINTER
#DEFINE ConstLogicalAddress AS POINTER//typedef const void * ConstLogicalAddress;
#DEFINE PhysicalAddress AS POINTER
#DEFINE BytePtr AS POINTER TO UInt8
#DEFINE ByteCount AS UInt32
#DEFINE ByteOffset AS UInt32
#DEFINE Duration AS SInt32
#DEFINE AbsoluteTime AS UnsignedWide
#DEFINE OptionBits AS UInt32
#DEFINE ItemCount AS UInt32
#DEFINE PBVersion AS UInt32
//#DEFINE ScriptCode AS SInt16
#DEFINE LangCode AS SInt16
#DEFINE RegionCode AS SInt16
#DEFINE FourCharCode AS unsigned long
//#DEFINE OSType AS FourCharCode
//#DEFINE ResType AS FourCharCode
#DEFINE OSTypePtr AS POINTER TO OSType
#DEFINE ResTypePtr AS POINTER TO ResType
/********************************************************************************
Boolean types and values
Boolean A one byte value, holds "false" (0) or "true" (1)
false The Boolean value of zero (0)
true The Boolean value of one (1)
*********************************************************************************/
/*
The identifiers "true" and "false" are becoming keywords in C++
and work with the new built-in type "bool"
"Boolean" will remain an unsigned char for compatibility with source
code written before "bool" existed.
*/
/*
#if !TYPE_BOOL
#if TARGET_OS_WIN32
// MS VC normally warns if true or false is defined
#pragma warning (disable: 4237)
#endif
enum {
false = 0,
true = 1
};
#if TARGET_OS_WIN32
#pragma warning (default: 4237)
#endif
#endif // !TYPE_BOOL
typedef unsigned char Boolean;
*/
/********************************************************************************
Function Pointer Types
ProcPtr Generic pointer to a function
Register68kProcPtr Pointer to a 68K function that expects parameters in registers
UniversalProcPtr Pointer to classic 68K code or a RoutineDescriptor
ProcHandle Pointer to a ProcPtr
UniversalProcHandle Pointer to a UniversalProcPtr
*********************************************************************************/
/*
typedef CALLBACK_API_C( long , ProcPtr )();
typedef CALLBACK_API( void , Register68kProcPtr )();
#if TARGET_OS_MAC && TARGET_RT_MAC_CFM
** Note that the RoutineDescriptor structure is defined in the MixedMode.h header
typedef struct RoutineDescriptor *UniversalProcPtr;
#else
typedef ProcPtr UniversalProcPtr;
#endif// TARGET_OS_MAC && TARGET_RT_MAC_CFM
typedef ProcPtr * ProcHandle;
typedef UniversalProcPtr * UniversalProcHandle;
*/
/********************************************************************************
Common Constants
noErr OSErr: function performed properly - no error
kNilOptions OptionBits: all flags false
kInvalidID KernelID: NULL is for pointers as kInvalidID is for ID's
kVariableLengthArray array bounds: variable length array
Note: kVariableLengthArray is used in array bounds to specify a variable length array.
It is ususally used in variable length structs when the last field is an array
of any size. Before ANSI C, we used zero as the bounds of variable length
array, but zero length array are illegal in ANSI C. Example usage:
struct FooList
{
short listLength;
Foo elements[kVariableLengthArray];
};
*********************************************************************************/
//_noErr = 0
_kNilOptions = 0
_kInvalidID = 0
_kVariableLengthArray = 1
_kUnknownType = 0x3F3F3F3F /* '????' QuickTime 3.0: default unknown ResType or OSType */
/********************************************************************************
String Types
UniChar A single 16-bit Unicode character
UniCharCount A count of Unicode characters in an array or buffer
StrNNN Pascal string holding up to NNN bytes
StringPtr Pointer to a pascal string
StringHandle Pointer to a StringPtr
ConstStrNNNParam For function parameters only - means string is const
CStringPtr Pointer to a C string (same as: char*)
ConstCStringPtr Pointer to a const C string (same as: const char*)
Note: The length of a pascal string is stored in the first byte.
A pascal string does not have a termination byte and can be at most 255 bytes long.
The first character in a pascal string is offset one byte from the start of the string.
A C string is terminated with a byte of value zero.
A C string has no length limitation.
The first character in a C string is the first byte of the string.
*********************************************************************************/
#DEFINE UniChar AS UInt16
#DEFINE UniCharCount AS UInt32
//typedef unsigned char Str255[256];
//typedef unsigned char Str63[64];
//typedef unsigned char Str32[33];
//typedef unsigned char Str31[32];
BEGIN RECORD Str27
DIM c.28
END RECORD
//typedef unsigned char Str27[28];
//typedef unsigned char Str15[16];
/*
The type Str32 is used in many AppleTalk based data structures.
It holds up to 32 one byte chars. The problem is that with the
length byte it is 33 bytes long. This can cause weird alignment
problems in structures. To fix this the type "Str32Field" has
been created. It should only be used to hold 32 chars, but
it is 34 bytes long so that there are no alignment problems.
*/
//typedef unsigned char Str32Field[34];
BEGIN RECORD Str32Field
DIM c.34
END RECORD
/*
QuickTime 3.0:
The type StrFileName is used to make MacOS structs work
cross-platform. For example FSSpec or SFReply previously
contained a Str63 field. They now contain a StrFileName
field which is the same when targeting the MacOS but is
a 256 char buffer for Win32 and unix, allowing them to
contain long file names.
*/
#DEFINE StrFileName As Str63
/*
#if TARGET_OS_MAC
typedef Str63 StrFileName;
#else
typedef Str255 StrFileName;
#endif // TARGET_OS_MAC
*/
//#DEFINE StringPtr AS POINTER TO unsigned char
#DEFINE StringHandle AS POINTER TO StringPtr
#DEFINE ConstStr255Param AS POINTER TO unsigned char
#DEFINE ConstStr63Param AS POINTER TO unsigned char
#DEFINE ConstStr32Param AS POINTER TO unsigned char
#DEFINE ConstStr31Param AS POINTER TO unsigned char
#DEFINE ConstStr27Param AS POINTER TO unsigned char
#DEFINE ConstStr15Param AS POINTER TO unsigned char
#DEFINE ConstStrFileNameParam AS ConstStr63Param
/*
#if TARGET_OS_MAC
typedef ConstStr63Param ConstStrFileNameParam;
#else
typedef ConstStr255Param ConstStrFileNameParam;
#endif // TARGET_OS_MAC
*/
/*
#ifdef __cplusplus
inline unsigned char StrLength(ConstStr255Param string) { return (*string); }
#else
#define StrLength(string) (*(unsigned char *)(string))
#endif // defined(__cplusplus)
#if OLDROUTINENAMES
#define Length(string) StrLength(string)
#endif //OLDROUTINENAMES
*/
/********************************************************************************
Quickdraw Types
Point 2D Quickdraw coordinate, range: -32K to +32K
Rect Rectangluar Quickdraw area
Style Quickdraw font rendering styles
StyleParameter Style when used as a parameter (historical 68K convention)
StyleField Style when used as a field (historical 68K convention)
CharParameter Char when used as a parameter (historical 68K convention)
Note: The original Macintosh toolbox in 68K Pascal defined Style as a SET.
Both Style and CHAR occupy 8-bits in packed records or 16-bits when
used as fields in non-packed records or as parameters.
*********************************************************************************/
/*
struct Point {
short v;
short h;
};
typedef struct Point Point;
*/
#DEFINE PointPtr AS POINTER TO Point
/*
struct Rect {
short top;
short left;
short bottom;
short right;
};
typedef struct Rect Rect;
*/
#DEFINE RectPtr AS POINTER TO RECT
#DEFINE CharParameter AS SHORT
/*
BEGIN enum
_normal = 0
_bold = 1
_italic = 2
_underline = 4
_outline = 8
_shadow = 0x10
_condense = 0x20
_extend = 0x40
END ENUM
*/
#DEFINE Style AS unsigned char
#DEFINE StyleParameter AS SHORT
#DEFINE StyleField AS Style
/********************************************************************************
THINK C base objects
HandleObject Root class for handle based THINK C++ objects
PascalObject Root class for pascal style objects in THINK C++
*********************************************************************************/
/*
#if defined(__SC__) && !defined(__STDC__) && defined(__cplusplus)
class __machdl HandleObject {};
#if TARGET_CPU_68K
class __pasobj PascalObject {};
#endif
#endif
*/
/********************************************************************************
MacOS versioning structures
VersRec Contents of a 'vers' resource
VersRecPtr Pointer to a VersRecPtr
VersRecHndl Resource Handle containing a VersRec
NumVersion Packed BCD version representation (e.g. "4.2.1a3" is 0x04214003)
UniversalProcPtr Pointer to classic 68K code or a RoutineDescriptor
ProcHandle Pointer to a ProcPtr
UniversalProcHandle Pointer to a UniversalProcPtr
*********************************************************************************/
//BIG_ENDIAN
BEGIn RECORD NumVersion
/* Numeric version part of 'vers' resource */
DIM majorRev AS UInt8/*1st part of version number in BCD*/
DIM minorAndBugRev AS UInt8/*2nd & 3rd part of version number share a byte*/
DIM stage AS UInt8/*stage code: dev, alpha, beta, final*/
DIM nonRelRev AS UInt8 /*revision level of non-released version*/
END RECORD
/*
//LITTLE_ENDIAN
struct NumVersion {
// Numeric version part of 'vers' resource accessable in little endian format
UInt8 nonRelRev; //revision level of non-released version
UInt8 stage; //stage code: dev, alpha, beta, final
UInt8 minorAndBugRev; //2nd & 3rd part of version number share a byte
UInt8 majorRev; //1st part of version number in BCD
};
typedef struct NumVersion NumVersion;
#endif // TARGET_RT_BIG_ENDIAN
*/
/*
BEGIN enum
// Version Release Stage Codes
_developStage = 0x20
_alphaStage = 0x40
_betaStage = 0x60
_finalStage = 0x80
END ENUM
*/
BEGIN RECORD NumVersionVariant/* NumVersionVariant is a wrapper so NumVersion can be accessed as a 32-bit value */
BEGIN UNION
DIM parts AS NumVersion
DIM whole AS unsigned long
END UNION
END RECORD
BEGIN RECORD VersRec/* 'vers' resource format */
DIM numericVersion AS NumVersion/*encoded version number*/
DIM countryCode AS short/*country code from intl utilities*/
DIM shortVersion AS STR255/*version number string - worst case*/
DIM reserved AS Str255/*longMessage string packed after shortVersion*/
END RECORD
#DEFINE VersRecPtr AS POINTER TO VersRec
#DEFINE VersRecHndl AS POINTER TO VersRecPtr
/*********************************************************************************
Old names for types
*********************************************************************************/
//typedef UInt8 Byte;
#DEFINE SignedByte AS SInt8
#DEFINE WidePtr AS POINTER TO wide
#DEFINE UnsignedWidePtr AS POINTER TO UnsignedWide
//typedef Float80 extended80;
//typedef Float96 extended96;
#DEFINE VHSelect AS SInt8
/*********************************************************************************
Debugger functions:
Name MacsBug Macintosh Debugger Copland Debugger
---------- ----------- ----------------------------- -------------------
Debugger yes InterfaceLib maps to DebugStr yes
DebugStr yes yes yes
Debugger68k yes InterfaceLib maps to DebugStr obsolete?
DebugStr68k yes InterfaceLib maps to DebugStr obsolete?
debugstr yes InterfaceLib maps to DebugStr yes
SysBreak no InterfaceLib maps to SysError obsolete?
SysBreakStr no InterfaceLib maps to SysError obsolete?
SysBreakFunc no InterfaceLib maps to SysError obsolete?
SysDebug ? ? ?
SysDebugStr ? ? ?
LLDebugger no yes Low Level Nub
LLDebugStr no yes Low Level Nub
*********************************************************************************/
/*
EXTERN_API( void )
Debugger (void) ONEWORDINLINE(0xA9FF);
EXTERN_API( void )
DebugStr (ConstStr255Param debuggerMsg) ONEWORDINLINE(0xABFF);
#if TARGET_OS_MAC
#if CGLUESUPPORTED
EXTERN_API_C( void )
debugstr (const char * debuggerMsg);
#endif // CGLUESUPPORTED
#if TARGET_CPU_PPC
// Only for System 7 native drivers
EXTERN_API_C( void )
SysDebug (void);
EXTERN_API_C( void )
SysDebugStr (ConstStr255Param str);
#endif // TARGET_CPU_PPC
// SADE break points
EXTERN_API( void )
SysBreak (void) THREEWORDINLINE(0x303C, 0xFE16, 0xA9C9);
EXTERN_API( void )
SysBreakStr (ConstStr255Param debuggerMsg) THREEWORDINLINE(0x303C, 0xFE15, 0xA9C9);
EXTERN_API( void )
SysBreakFunc (ConstStr255Param debuggerMsg) THREEWORDINLINE(0x303C, 0xFE14, 0xA9C9);
// old names for Debugger and DebugStr
#if OLDROUTINENAMES && TARGET_CPU_68K
#define Debugger68k() Debugger()
#define DebugStr68k(s) DebugStr(s)
#endif
#endif /* TARGET_OS_MAC
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#elif PRAGMA_STRUCT_PACKPUSH
#pragma pack(pop)
#elif PRAGMA_STRUCT_PACK
#pragma pack()
#endif
#ifdef PRAGMA_IMPORT_OFF
#pragma import off
#elif PRAGMA_IMPORT
#pragma import reset
#endif
#ifdef __cplusplus
}
#endif
#endif __MACTYPES__ */